import { Effect } from 'dva';
import { Reducer } from 'redux';

interface LoginModelType {
  namespace: 'login';
  state: null;
  effects: {
    logout: Effect,
  };
  reducers: {
    logout: Reducer<any>,
  }
}

const LoginModel: LoginModelType = {
  namespace: 'login',
  state: null,
  effects: {
    *logout(_, { put }) {
      yield put({
        type: 'logout'
      });
    }
  },
  reducers: {
    logout(state, _) {
      return {
        ...state
      };
    }
  }
};

export default LoginModel;
